/*
 * PageList.java 1.0 Created on 2003. 2. 24. 
 */
 
package eastar.util;

import java.text.*;
import java.util.*;
import java.io.*;
import java.util.regex.*;

public class GridColumn {
	
	
	private String columnStyle;
	
	private ArrayList objectList;
	
	public GridColumn(String columnStyle) 
	{
		this.columnStyle = columnStyle;
		this.objectList = new ArrayList();
	}
	
	public String getColumnStyle() {
		return this.columnStyle;
	}
	
	public ArrayList getObjectList() 
	{
		return this.objectList;
	}
	
	
	private GridColumn add(String objectType, String objectName, String objectStyle) 
	{
		HashMap map = new HashMap();
		map.put("objectType", objectType);
		map.put("objectName", objectName);
		map.put("objectStyle", objectStyle);
		
		objectList.add(map);
		
		return this;
	}
	
	private GridColumn add(String objectType, String objectName) 
	{
		return add(objectType, objectName);
	}
	
	public GridColumn addText(String objectName, String objectStyle) 
	{
		return add("text", objectName, objectStyle);
	}
	
	public GridColumn addText(String objectName) 
	{
		return add("text", objectName, "");
	}
	
	public GridColumn addCheckBox(String objectName, String objectStyle) 
	{
		return add("checkbox", objectName, objectStyle);
	}
	
	public GridColumn addHidden(String objectName, String objectStyle) 
	{
		return add("hidden", objectName, objectStyle);
	}
	
	public GridColumn addHidden(String objectName) 
	{
		return add("hidden", objectName, "");
	}
	
	public GridColumn addSelect(String objectName, String objectStyle, CommonList codeList) 
	{
		HashMap map = new HashMap();
		map.put("objectType", "select");
		map.put("objectName", objectName);
		map.put("objectStyle", objectStyle);
		map.put("codeList", codeList);
		
		objectList.add(map);
		return this;
	}
	
	public GridColumn addHtml(String objectName) 
	{
		return add("html", objectName, "");
	}
		
	public GridColumn addValue(String objectName) 
	{
		return add("value", objectName, "");
	}
	
	public GridColumn addCalendar(String objectName, String objectStyle) 
	{
		return add("calendar", objectName, objectStyle);
	}
	
	public GridColumn addPopup(String objectName) 
	{
		return add("popup", objectName, "");
	}
	
	public GridColumn addPopup(String objectName, String objectStyle) 
	{
		return add("popup", objectName, objectStyle);
	}
}
